
module.exports = {
	_before: function () { // 通用预处理器
		
	},	
	async add(params={}){	
		const dbJQL = uniCloud.databaseForJQL({
			clientInfo: this.getClientInfo()
		});
		return await dbJQL.collection("pro-blog").add(params);
	},
	async list(){
		const dbJQL = uniCloud.databaseForJQL({
			clientInfo: this.getClientInfo()
		});
		let blogTemp = dbJQL.collection("pro-blog").orderBy("publish_date desc").getTemp();
		let userTemp = dbJQL.collection("uni-id-users").field("_id,nickname,avatar_file").getTemp();
		return dbJQL.collection(blogTemp,userTemp).get();
	},
	async remove(id){
		const dbJQL = uniCloud.databaseForJQL({
			clientInfo: this.getClientInfo()
		});
		return await dbJQL.collection("pro-blog").doc(id).remove();
	}
}
